package com.fangs.yehwangglobal.base;

public class BaseResultEntity<T> {

    private int errorCode;
    private String errorMsg;
    private T data;

    //该方法假设服务器返回200表示成功返回结果，其他数字表示异常
    public boolean isOk() {
        return errorCode == 0;
    }

    //未登录
    public boolean isOut() {
        return errorCode == 202;
    }

    public int getCode() {
        return errorCode;
    }

    public void setCode(int code) {
        this.errorCode = code;
    }

    public String getMessage() {
        return errorMsg;
    }

    public void setMessage(String message) {
        this.errorMsg = message;
    }

    public T getData() {
        // if (result != null)
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
